

import { observable, action } from 'mobx'
import { ajax } from '../../api'

class User {

    // 公告数据
    @observable annoList: Array<object> = []
    @action getAnnoListAsync = async (payload: any) => {
        let { code, result }: any = await ajax.getannolist(payload)
        if (code == 200) {
            this.annoList = result;
        }
    }

    @action getAnnoList = (payload: any) => {
        this.annoList = payload
    }

    // 个人信息
    @observable userInfo = null
    @action changeUserInfo = (payload: any) => {
        this.userInfo = { ...JSON.parse(JSON.stringify(this.userInfo)), ...payload }
    }

    // 管理员列表
    @observable userList = []
    @action ChangeUserList = (payload: any) => {
        this.userList = payload
    }

}

export default new User()